<template>
  <div class="paging">
    <div>显示&nbsp;{{one}}&nbsp;到&nbsp;{{two}}&nbsp;项，共&nbsp;{{total}}&nbsp;项</div>
    <el-pagination
      background
      layout="prev, pager, next"
      @current-change="currentPage"
      :total="pageSum * 10">
    </el-pagination>
  </div>
</template>

<script>
  import {mapState} from 'vuex'
  export default {
    name: "Paging",
    props: ['pageSum','total'],
    methods: {
      currentPage(val){
        // console.log(val);
        this.changePage = val
      }
    },
    computed: {
      ...mapState('Information',['changePage','changeLimit']),
      changePage:{
        get(){
          return this.$store.state.Information.changePage
        },
        set(val){
          return this.$store.state.Information.changePage = val
        }
      },
      one(){
        return (this.changePage - 1) * this.changeLimit + 1
      },
      two(){
        return this.changePage * this.changeLimit
      }
    }
  }
</script>

<style scoped>
  .paging{
    width: 94%;
    margin: auto;
    height: 50px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    font-size:14px;
    color:gray;
  }
</style>